package com.example.hrv.Algorithm;

import android.os.Parcel;
import android.os.Parcelable;

public class ResultOfHRV implements Parcelable {
    public int caculateFlag;//计算结果
    public int heartRate;
    public double BRPA;//身体抗压能力
    public double BFS;//身体疲劳状态
    public double BPS;//精神压力状态
    public double EMS; //  精神情绪状态
    public double Attention;//注意力
    public double RRMean;//RR间期均值
    public double RMSSD;//相邻RR间期的差的均方根
    public double CV;//变异系数
    public double SDSD; //相邻RR间期差值的标准差
    public double SDNN;//RR间期标准差
    public double NN50;//相邻RR间期的差值超过50ms的心搏数
    public double PNN50;//相邻RR间期的差值超过50ms的心搏数占RR间期总搏数的百分比
    public double DRR;//极差
    //频域
    public double TP;//总功率
    public double VLF;//极低频功率
    public double LF;//低频功率
    public double HF;//高频功率
    public double LFHF;//低高频比
    public double LFnorm;//归一化的低频功率
    public double HFnorm;//归一化的高频功率

    public ResultOfHRV() {
        caculateFlag = 0;
        BRPA = 0.0;
        BFS = 0.0;
        BPS = 0.0;
        EMS = 0.0;
        Attention = 0.0;

        RRMean = 0.0;
        RMSSD = 0.0;
        CV = 0.0;
        SDSD = 0.0;
        SDNN = 0.0;
        NN50 = 0.0;
        PNN50 = 0.0;
        DRR = 0.0;
        //频域
        TP = 0.0;
        VLF = 0.0;
        LF = 0.0;
        HF = 0.0;
        LFHF = 0.0;
        LFnorm = 0.0;
        HFnorm = 0.0;
    }

	@Override
	public String toString() {
		return "ResultOfHRV [caculateFlag=" + caculateFlag + ", heartRate="
				+ heartRate + ", BRPA=" + BRPA + ", BFS=" + BFS + ", BPS="
				+ BPS + ", EMS=" + EMS + ", Attention=" + Attention
				+ ", RRMean=" + RRMean + ", RMSSD=" + RMSSD + ", CV=" + CV
				+ ", SDSD=" + SDSD + ", SDNN=" + SDNN + ", NN50=" + NN50
				+ ", PNN50=" + PNN50 + ", DRR=" + DRR + ", TP=" + TP + ", VLF="
				+ VLF + ", LF=" + LF + ", HF=" + HF + ", LFHF=" + LFHF
				+ ", LFnorm=" + LFnorm + ", HFnorm=" + HFnorm + "]";
	}

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.caculateFlag);
        dest.writeInt(this.heartRate);
        dest.writeDouble(this.BRPA);
        dest.writeDouble(this.BFS);
        dest.writeDouble(this.BPS);
        dest.writeDouble(this.EMS);
        dest.writeDouble(this.Attention);
        dest.writeDouble(this.RRMean);
        dest.writeDouble(this.RMSSD);
        dest.writeDouble(this.CV);
        dest.writeDouble(this.SDSD);
        dest.writeDouble(this.SDNN);
        dest.writeDouble(this.NN50);
        dest.writeDouble(this.PNN50);
        dest.writeDouble(this.DRR);
        dest.writeDouble(this.TP);
        dest.writeDouble(this.VLF);
        dest.writeDouble(this.LF);
        dest.writeDouble(this.HF);
        dest.writeDouble(this.LFHF);
        dest.writeDouble(this.LFnorm);
        dest.writeDouble(this.HFnorm);
    }

    protected ResultOfHRV(Parcel in) {
        this.caculateFlag = in.readInt();
        this.heartRate = in.readInt();
        this.BRPA = in.readDouble();
        this.BFS = in.readDouble();
        this.BPS = in.readDouble();
        this.EMS = in.readDouble();
        this.Attention = in.readDouble();
        this.RRMean = in.readDouble();
        this.RMSSD = in.readDouble();
        this.CV = in.readDouble();
        this.SDSD = in.readDouble();
        this.SDNN = in.readDouble();
        this.NN50 = in.readDouble();
        this.PNN50 = in.readDouble();
        this.DRR = in.readDouble();
        this.TP = in.readDouble();
        this.VLF = in.readDouble();
        this.LF = in.readDouble();
        this.HF = in.readDouble();
        this.LFHF = in.readDouble();
        this.LFnorm = in.readDouble();
        this.HFnorm = in.readDouble();
    }

    public static final Creator<ResultOfHRV> CREATOR = new Creator<ResultOfHRV>() {
        @Override
        public ResultOfHRV createFromParcel(Parcel source) {
            return new ResultOfHRV(source);
        }

        @Override
        public ResultOfHRV[] newArray(int size) {
            return new ResultOfHRV[size];
        }
    };
}
